;solution for euler 57
(defvar count-num>den 0)

(defun e57 (level)
	(let ((val 0) (val2 0))
		(decf level)
		(when (= level 0) (return-from e57 (/ 1 2)))
		(setf val (/ 1 (+ 2 (e57 level))))
		(setf val2 (+ val 1))
		(when (> (length (write-to-string (numerator val2))) 
				(length (write-to-string (denominator val2))))
			(incf count-num>den))
		(return-from e57 val)))
		
(defun solve-euler57 ()
	(setf count-num>den 0)
	(e57 1000)
	(format t "Euler 57:~a" count-num>den))
		